﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TeamCommunitySolution.Domain.DataLayer.Base;
using TeamCommunitySolution.Domain.DataLayer.TeamEvents;
using TeamCommunitySolution.Modules.Base.Requests;

namespace TeamCommunitySolution.Modules.TeamEvents.Requests
{
    /// <summary>
    /// Team Event Invite Request.
    /// </summary>
    public class TeamEventInviteRequest : SystemRequest
    {
        /// <summary>
        /// Internal holder
        /// </summary>
        private IList<SystemUser> inviteeList = new List<SystemUser>();

        /// <summary>
        /// Gets or sets the team event.
        /// </summary>
        /// <value>The team event.</value>
        public TeamEvent TeamEvent
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets a value indicating whether this instance is attending.
        /// </summary>
        /// <value>
        /// <c>true</c> if this instance is attending; otherwise, <c>false</c>.
        /// </value>
        public bool IsAttending
        {
            get;
            set;
        }

        /// <summary>
        /// Gets the invitation count.
        /// </summary>
        /// <value>The invitation count.</value>
        public int InvitationCount
        {
            get { return this.inviteeList.Count; }
        }

        /// <summary>
        /// Adds the invitee.
        /// </summary>
        /// <param name="user">The user to add.</param>
        public void AddInvitee(SystemUser user)
        {
            if (!this.inviteeList.Contains(user))
            {
                this.inviteeList.Add(user);
            }
        }

        /// <summary>
        /// Removes the invitee.
        /// </summary>
        /// <param name="user">The user to remove.</param>
        public void RemoveInvitee(SystemUser user)
        {
            if (this.inviteeList.Contains(user))
            {
                this.inviteeList.Remove(user);
            }
        }

        /// <summary>
        /// Gets the invitee.
        /// </summary>
        /// <param name="position">The position.</param>
        /// <returns>The System User Instance.</returns>
        public SystemUser GetInvitee(int position)
        {
            return inviteeList[position];
        }
    }
}
